package com.snack.controller;

import com.snack.common.result.Result;
import com.snack.entity.pojo.Store;
import com.snack.entity.pojo.User;
import com.snack.service.UserService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

/**
 * @author huangfuhao
 * @Date 2025/3/18
 */
@RestController
@RequestMapping("/api/user")
public class UserController {

    @Resource
    private UserService userService;

    //为某个店铺新增店长
    @PostMapping("/addManager")
    public Result addManger(@RequestBody User user) {
        return userService.addManager(user);
    }

    //新增普通员工
    @PostMapping("/addEmployee")
    public Result addEmployee(@RequestBody User user) {
        return userService.addEmployee(user);
    }

    //获取员工列表
    @GetMapping("/listEmployee")
    public Result listEmployee() {
        return userService.listEmployee();
    }

    //删除员工
    @PostMapping("/deleteEmployee")
    public Result deleteEmployee(@RequestBody User user) {
        return  userService.deleteEmployee(user);
    }

    //更新用户信息
    @PostMapping("/updateUser")
    public Result updateUser(@RequestBody User user) {
        return userService.updateUser(user);
    }
}
